/*
 * Copyright (c) 2009, Servoy-stuff
 * 
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, write to the Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
 * http://www.fsf.org/licensing/licenses/lgpl.txt
 */

package net.stuff.servoy.beans.calendar.wicket;

import java.awt.Insets;
import java.util.Iterator;
import java.util.Properties;

import net.stuff.servoy.beans.calendar.DateChooserHelpers;

import com.servoy.j2db.server.headlessclient.dataui.ChangesRecorder;
import com.servoy.j2db.util.Debug;

/**
 * 
 * @author servoy-stuff
 * http://www.servoy-stuff.net/
 */
public class ExtendedChangesRecorder extends ChangesRecorder {

	public ExtendedChangesRecorder(Insets paramInsets1, Insets paramInsets2) {
	    super(paramInsets1, paramInsets2);
	}
	
	public void setOverflow(String paramString) {
		super.setChanged();
		Properties prop = super.getChanges();
		prop.put("overflow", paramString);
		super.setChanges(prop);
	}
	
	public void setHorizontalAlignment(int paramInt) {
		super.setChanged();
		Properties prop = super.getChanges();
		String paramString = DateChooserHelpers.getWicketHorizontalAlignment(paramInt);
		prop.put("text-align", paramString);
		super.setChanges(prop);
	}
		 
	/* (non-Javadoc)
	 * @see com.servoy.j2db.server.headlessclient.dataui.ChangesRecorder#getChanges()
	 */
	@Override
	public Properties getChanges() {
		 Properties prop = super.getChanges();
		 if (Debug.tracing() && prop != null && prop.size() > 0) {
			Debug.log("ChangesRecorder - getChanges called");
			for (Iterator iterator = prop.keySet().iterator(); iterator.hasNext();) {
				String key = (String) iterator.next();
				String value = prop.getProperty(key);
				Debug.log("Changes - "+key+" = "+value);
			}
		 }
		 return prop;
	 }
}
